<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>修改密码</title>
    <meta name="keywords" content="台">
    <meta name="description" content="789">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="css/bootstrap.min.css-v=3.3.5.css"
          tppabs="http://www.zi-han.net/theme/hplus/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="css/font-awesome.min.css-v=4.4.0.css"
          tppabs="http://www.zi-han.net/theme/hplus/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="css/animate.min.css" tppabs="http://www.zi-han.net/theme/hplus/css/animate.min.css" rel="stylesheet">
    <link href="css/plugins/summernote/summernote.css"
          tppabs="http://www.zi-han.net/theme/hplus/css/plugins/summernote/summernote.css" rel="stylesheet">
    <link href="css/plugins/summernote/summernote-bs3.css"
          tppabs="http://www.zi-han.net/theme/hplus/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
    <link href="css/style.min.css-v=4.0.0.css" tppabs="http://www.zi-han.net/theme/hplus/css/style.min.css?v=4.0.0"
          rel="stylesheet">
    <style>
        .droppable-active {
            background-color: #ffe !important
        }

        .tools a {
            cursor: pointer;
            font-size: 80%
        }

        .form-body .col-md-6,
        .form-body .col-md-12 {
            min-height: 400px
        }

        .draggable {
            cursor: move
        }
        .col-sm-5{
            width: 100% !important;
            height: 100%;
        }
        .wrapper,.wrapper-content{
            height:600px  !important;
        }
        .row{
            height: 100% !important;
        }
        .ibox,.float-e-margins{
            height:100%;
        }
        .ibox-content{
            height: 520px;
        }
        .col-sm-9{
            width: 40%;
        }
         #zhuti{
             height:100%;

         }
        #zhuti::before{
            background:  url('img/logo1.png')  no-repeat fixed center;
            content:"";
            opacity:0.2;//透明度设置
        z-index:-1;
            width:2000px;
            height:1300px;
            position:absolute;
            /*top:0px;*/
            /*left:0px;*/
            /*border-radius:40px*/
        }
        #xiaohuiid{
            border-top: 0;
            padding-left: 20px;
            height:360px;
            background-color: #fff;
            margin-right: -15px;
            margin-left: -15px;
        }

    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content">

    <div class="row">
        <div class="col-sm-5">
            <div class="ibox float-e-margins" id="zhuti">
                <div class="ibox-title">
                    <h5>修改密码</h5>
                    <div class="ibox-tools">

                    </div>
                </div>
                <div class="ibox-content">
                    <div class="form-horizontal m-t">
                        <div class="form-group draggable">
                            <label class="col-sm-3 control-label">当前密码：</label>
                            <div class="col-sm-9">
                                <input type="password" name="" id="dangqianmima" class="form-control" placeholder="请输入当前密码"  required>

                            </div>
                        </div>
                        <div class="form-group draggable">
                            <label class="col-sm-3 control-label">新密码：</label>
                            <div class="col-sm-9">
                                <input type="password" id="xinmima" class="form-control" name="password" placeholder="请输入新密码" required>
                            </div>
                        </div>
                        <div class="form-group draggable">
                            <label class="col-sm-3 control-label">确认新密码：</label>
                            <div class="col-sm-9">
                                <input type="password" id="querenxinmima" class="form-control" name="password" placeholder="再输入一次新密码" required>
                            </div>
                        </div>
                        <div class="form-group draggable">
                            <div class="col-sm-12 col-sm-offset-3">
                                <button id="mimatijiao" class="btn btn-primary" type="submit">保存</button>
                                <button class="btn btn-white" type="reset">重置</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>
<script src="js/jquery.min.js-v=2.1.4" tppabs="http://www.zi-han.net/theme/hplus/js/jquery.min.js?v=2.1.4"></script>
<script src="layui/layer/layer.js" type="text/javascript" charset="utf-8"></script>
<script>
    $(document).ready(function(){

        $("#dangqianmima").on("blur",function(){
            var param=$("#dangqianmima").val();
            if(param!="")
            {
                $.ajax({
                    type:"POST",
                    url:"/user/judgeOldPwd",
                    data:{
                        "oldPwd":param,
                    },
                    success:function(mg){
                        if(mg!=("true"))     {
                            layer.alert("当前密码错误，请重新输入");
                            $("#dangqianmima").val("");
                        }
                    },
                    error:function(mg){
                        console.log(mg);
                    },
                });
            }//判空结束
        });
        $("#xinmima").on("blur",function(){
            var dangqianmima = $("#dangqianmima").val();
            var  xinmima = $("#xinmima").val();
            if($.trim(dangqianmima) == $.trim(xinmima)&&dangqianmima!=""&&xinmima!="")
            {
                layer.alert("当前密码与新密码相同，请输入新密码");
                $("#xinmima").val("");
            };
        });
        $("#querenxinmima").on("blur",function(){
            var  xinmima = $("#xinmima").val();
            var querenxinmima = $("#querenxinmima").val();
            if($.trim(querenxinmima) != $.trim(xinmima)&&xinmima!=""&&querenxinmima!="")
            {
                layer.alert("新密码与确认密码不同，请重新输入确认密码");
                $("#querenxinmima").val("");
            };
        });
        $("#mimatijiao").click(function(){
            var dangqianmima = $("#dangqianmima").val();
            var xinmima = $("#xinmima").val();
            var querenxinmima = $("#querenxinmima").val();
            if(xinmima!=""&&querenxinmima!=""&&dangqianmima!="")
            {
                $.ajax({
                    type:"POST",
                    url:"/user/changePwd",
                    data:{
                        "password":dangqianmima,
                        "newPwd":xinmima ,
                        "cfgPwd":querenxinmima
                    },
                    success:function(mg)
                    {
                        console.log(mg);
                        layer.alert("修改成功");


                        $("#dangqianmima").val("");
                        $("#xinmima").val("");
                        $("#querenxinmima").val("");
                        window.setInterval(function () {
                            top.location.href="/user/logout";},1500);
                    },
                    error:function(mg){
                        layer.alert("修改失败");
                    },
                });
            };//  if 结束
        });//提交
    });
</script>
<script src="js/bootstrap.min.js-v=3.3.5"
        tppabs="http://www.zi-han.net/theme/hplus/js/bootstrap.min.js?v=3.3.5"></script>
<script src="js/content.min.js-v=1.0.0"
        tppabs="http://www.zi-han.net/theme/hplus/js/content.min.js?v=1.0.0"></script>
<script src="js/jquery-ui-1.10.4.min.js"
        tppabs="http://www.zi-han.net/theme/hplus/js/jquery-ui-1.10.4.min.js"></script>
<script src="js/plugins/beautifyhtml/beautifyhtml.js"
        tppabs="http://www.zi-han.net/theme/hplus/js/plugins/beautifyhtml/beautifyhtml.js"></script>

<script type="text/javascript" src="../../../tajs.qq.com/stats-sId=9051096"
        tppabs="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
</body>

</html>